<template>
	<view class="mytabbar">
		
		
		
		<view class="tabbar-item" v-for="item in list" :key="item.id" @click="itemClick(item)">
			<image :src="selectedId == item.id? item.selectedIconPath:item.iconPath"></image>
			<text :class="selectedId == item.id? 'selectedColor': ''">{{item.text}}</text>
		</view>
		
	</view>
</template>		

<script>
	export default {
		name:"mytabbar",
		props:["list"],
		onLoad() {
			this.$emit("tabbarClicked", item.id)
		},
		data() {
			return {
				selectedId: 1001,
			};
		},
		methods: {
			itemClick(item) {
				this.selectedId = item.id
				this.$emit("tabbarClicked", item.id)
			}
		}
	}
</script>

<style lang="scss">
	
	.mytabbar {
		width: 750rpx;
		height: 100rpx;
		background-color: #FFFFFF;
		
		position: fixed;
		bottom: 0;
		
		display: flex;
		align-items: center;
		justify-content: space-around;
		.tabbar-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			image {
				width: 45rpx;
				height: 45rpx;
			}
			// 动态选中的文字颜色
			.selectedColor {
				color: #4ad294;
			}
			
			text {
				padding-top: 10rpx;
				font-size: 18rpx;
				color: #c3c3c3;
			}
		}
	}
	
</style>
